package com.njegovanobradovic.so.impl;

import org.apache.tapestry5.ioc.annotations.Inject;

import com.njegovanobradovic.core.dao.HibernateDAO;
import com.njegovanobradovic.so.Get;

public class GetImpl<Type> implements Get<Type>{
	@Inject
	private HibernateDAO dao;
	private Long id;
	private Class<Type> searchForType;

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Class<Type> getSearchForType() {
		return searchForType;
	}
	public void setSearchForType(Class<Type> searchForType) {
		this.searchForType = searchForType;
	}
	public Type execute() {
		try {
			return dao.get(id, getSearchForType());
		} catch (Exception e) {
			return null;
		}
	}
}
